package com.bossien.flink.common;

import com.bossien.flink.factory.MapperProxyFactory;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @author 胡春林
 * 实现Factorybean  引进代理
 * @param
 */
@Data
@Accessors(chain = true)
public class FlinkMapperAnnotationFactoryBean<T> implements FactoryBean<T>,InitializingBean {

    private Class<T> iMapperClass;

    private MapperProxyFactory mapperProxyFactory = null;

    @Override
    public T getObject() {

        return mapperProxyFactory.newInstance(iMapperClass);
    }

    @Override
    public Class<T> getObjectType() {
        return iMapperClass;
    }

    public boolean isSingleton() {
        return true;
    }

    @Override
    public void afterPropertiesSet() throws Exception {

    }
}
